# -*-coding=utf-8-*-

import numpy as np
import time
from PIL import Image


class Window():
    def __init__(self, width, height):
        self.width = width
        self.height = height
        self.eye_position = np.array([0, 0, (width+height)/4], 'f')
        self.color_map = np.zeros((self.height, self.width, 3), 'f')

    def show(self):
        """
        显示渲染内容
        """
        img = Image.new('RGB', (self.width, self.height))
        for x in range(self.width):
            for y in range(self.height):
                img.putpixel((x, y), tuple(self.color_map[y, x] * 255))
        img.show()
        img.save(str(int(time.time())) + '.jpg')
